<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('编辑消息模板')" />
    <th:block th:include="include :: summernote-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-template-edit" th:object="${sysMessageTemplate}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">模板编码：</label>
                <div class="col-sm-10">
                    <input name="templateCode" th:field="*{templateCode}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">模板名称：</label>
                <div class="col-sm-10">
                    <input name="templateName" th:field="*{templateName}" class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label is-required">模板主体：</label>
                <div class="col-sm-10">
                    <textarea rows="10" cols="20" name="templateBody" th:field="*{templateBody}" class="form-control" required></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">模板描述：</label>
                <div class="col-sm-10">
                    <textarea name="templateDesc" class="form-control" required>[[*{templateDesc}]]</textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">消息类型：</label>
                <div class="col-sm-10">
                    <div class="radio-box" th:each="dict : ${@dict.getType('message_template_type')}">
                        <input type="radio" th:id="${'templateType_' + dict.dictCode}" name="templateType" th:value="${dict.dictValue}" th:field="*{templateType}">
                        <label th:for="${'templateType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">消息状态：</label>
                <div class="col-sm-10">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_notice_status')}">
                        <input type="radio" th:id="${'templateStatus_' + dict.dictCode}" name="templateStatus" th:value="${dict.dictValue}" th:field="*{templateStatus}">
                        <label th:for="${'templateStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: summernote-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/template";


        $("#form-template-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-template-edit').serialize());
            }
        }
    </script>
</body>
</html>